package com.enation.app.javashop.api.client;

import com.enation.app.javashop.model.trade.order.dos.PayLog;
import com.enation.app.javashop.service.payment.PayLogManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

/**
 * 支付日志SDK
 *
 * @author fk create in 2020/4/7
 * @version v2.0
 * @since v7.2.0
 */
@RestController
@RequestMapping("/client/payment/pay-log")
@Validated
@ApiIgnore
public class PayLogClientController {

    @Autowired
    private PayLogManager payLogManager;

    @PostMapping
    public PayLog add(@RequestBody PayLog payLog) {
        return payLogManager.add(payLog);
    }

    @PutMapping("/{id}")
    public PayLog edit(@RequestBody PayLog payLog, @PathVariable("id") Long id) {
        return payLogManager.edit(payLog, id);
    }

    @GetMapping("/order/{order_sn}")
    public PayLog getModel(@PathVariable("order_sn") String orderSn) {
        return payLogManager.getModel(orderSn);
    }
}
